<style>
html{line-height:1.6;font-size:16px;}
body{margin: 0 0;font-size:16px;background-image:none;background-size: cover;background-repeat: no-repeat;line-height:inherit}
body,h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6{font-family: "Helvetica Neue",Helvetica,"Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif}
a:hover, a:focus {text-decoration: none;}
.tags-filter a {margin: 0px 0px;padding: 5px 8px;display: inline-block;color: #777;text-decoration: underline;}
.tags-filter a.active{color: #E84E0F;background-color:transparent;text-decoration: none;border: 1px solid #E84E0F;border-radius: 4px;}
.editor-style-content {overflow: hidden;font-size:16px;word-break: break-word;}
.editor-style-content * {max-width: 100%!important;box-sizing: border-box!important;-webkit-box-sizing: border-box!important;font-size:inherit;margin:0;padding:0;font-style: normal;}
.editor-style-content p{margin:0 0;clear:both;min-height:1em;}
.editor-style-content h1,.editor-style-content h2,.editor-style-content h3,.editor-style-content h4,.editor-style-content h5,.editor-style-content h6{font-size:18px;}
.style-list{margin-bottom:20px;box-shadow: 0 0 3px rgba(172,165,150,0.5);background:#E4e4e4;padding:0px;position:relative;border-radius:2px;}
.style-list:hover{z-index:20;box-shadow: 0 0 5px rgba(172,165,150,0.5);}
.style-list:hover .tools{display:block;}
.style-list .content{background:#fefefe;padding:13px;max-height:520px;overflow:hidden;}
.style-list .tools{text-align:left;width:100%;padding:15px;}
.style-list .info{text-align:left;color:#aaa;font-size: 12px;line-height: 2.5em;}
.style-list .info p{margin:0;}.style-list .info small{display: inline-block;}    
.style-list .tools a,.style-list .tools a:hover{text-decoration: none;color:#999;font-size:16px;}
.style-list .tools .title{line-height:24px;}
.btn-primary,.style-list .tools .label-info{font-size:12px;background:#e6dfd0 !important;color:#3a3332 !important;font-weight: normal;border:0 none;}
.style-list .tools .label-info{background:#ccc !important;margin: 2px 0;display: inline-block;}
.btn-primary:hover,.style-list .tools .label-info:hover{font-size:12px;background:#E84E0F !important;color:#FFF !important;font-weight: normal;}
/* fix Firefox - max-width images not working within fieldset */
fieldset img{width: 100%;max-width: -moz-fit-content;max-width: -webkit-fit-content;}

.btn-red,.btn-red:hover,.btn-red:focus{font-size:16px;color:#ed603a !important;}

.style-list .origin{position:absolute;top:0;right:0;height:32px;color:#FFF;font-weight:bold;padding:5px}
.nav-pills > li.active > a:hover,.nav-pills > li.active > a,.nav-pills > li > a:hover{color:#f8f5ef !important;background:#E84E0F !important;border:0 none;}
.nav-pills > li >a {background:#e6dfd0;color:#3a3332;padding:5px 15px;margin-right:25px;border-radius:3px;border:0 none;}
.nav-pills {border-bottom: 0 none;}
body.boxed{width: 1290px;}
.container{width:1290px;padding-left: 40px;padding-right: 40px; }
#maincontent .container{background: #f2f2f2;}
.col-md-4{padding-left:20px;padding-right:20px;}
.template-cover{width:340px;height:480px;max-width: 100%;}
.color-swatch{width:30px;height:30px;border-radius:3px;font-size:12px;cursor: pointer;display: inline-block;margin:4px 4px 0px 0;}
.color-swatch:hover,.color-swatch.active {	
	-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-ms-transform:scale(1.1);
	-o-transform:scale(1.1);transform:scale(1.1);
	-webkit-box-shadow:inset 1px 1px 1px #5b616d,0 0 5px #45bcda;
	-moz-box-shadow:inset 1px 1px 1px #5b616d,0 0 5px #45bcda;
	box-shadow:inset 1px 1px 1px #5b616d,0 0 5px #45bcda;
}
.tooltip-inner{text-align:left;padding:10px 15px;}
.footer-top {
    background: #f2f2f2;
}
.hoverimg:hover{background:#000;}
.transparent{background:transparent !important;}
.ui-portlet-header .title{border-top:0 none;}
#link-urls{
	margin-top: 20px;
}
#link-urls a{ height:40px;margin-right:20px !important;width:120px;text-align:center;display:inline-block;}
</style>
<div class="container" style="background:#FFF;">	
	<portlet cache="900" portlet="body" model="Advertise" limit="4" conditions="published=1&cate_id=233" order="priority desc" list_tpl="inner">
		<a href="/advertises/click/{{$item['id']}}" target="_blank" title="{{$item['slogan']}}" style="width:25%;{{if $key==0}}padding:15px 20px 15px 0;{{elseif $key==3}}padding:15px 0px 15px 20px;{{else}}padding:15px 10px;{{/if}}display:inline-block;">
			<img src="{{$item['photo']}}" alt="{{$item['slogan']}}" style="border-radius:5pt;">
		</a>
	</portlet>
</div>

<div class="container">	
	
<ul class="nav nav-pills" style="margin-top:20px;">
{{if !empty($_SESSION['Auth']['Staff']) }}
	  <li role="presentation"><a href="/style-center?cate_id%3C%3E=3&order=recommend%20desc,click_nums"><i class="fa fa-thumbs-o-up"></i>已推荐样式维护</a></li>
{{/if}}	  
  
  <li role="presentation" {{if $category_data_model=='EditorStyle' && $_GET['cate_id']!=3}}class="active"{{/if}}><a href="/style-center?cate_id%3C%3E=3&order=updated">样式</a></li>
  <li role="presentation" {{if $category_data_model=='EditorStyle' && $_GET['cate_id']==3 && !isset($_GET['status'])}}class="active"{{/if}}><a href="/template-center?cate_id=3">模板</a></li>  
  <li role="presentation" {{if $category_data_model=='Image'}}class="active"{{/if}}><a href="/pictures?cate_id%3C%3E[]=84&cate_id%3C%3E[]=85">图片库</a></li>
  <li role="presentation" {{if $category_data_model=='Video'}}class="active"{{/if}}><a href="/videos">视频库</a></li>
  <li role="presentation" {{if $category_data_model=='Color'}}class="active"{{/if}}><a href="/color-plans">配色方案</a></li>
  
</ul>
<div class="clearfix" style="margin-top:10px;color:#999;font-size: 14px;">
<!-- 
<div class="pull-right">
	<a href="javascript:void(0)" class="btn btn-warning btn-sm" onclick="if(confirm('确认要收藏本页所有样式？需要积分收藏的将自动扣除积分')) $('.btn-favorite').trigger('click');">一键收藏本页所有样式</a>
</div> -->
<?php 
function is_wechat_gif($url){
	if(strpos($url,'http://image1.135editor.com/cache/remote/') !== false) {
		$source_url = base64_decode(substr($url,41));
		if(substr($source_url,-10) == 'wx_fmt=gif'){
			return $source_url;
		}
	}
	return false;
}
?>	
{{if $category_data_model=='EditorStyle' && $_GET['cate_id'] != 3 }}
	
	<ul class="nav nav-tabs">
		<li><a href="/style-center?cate_id=1">全部</a></li>
		<li {{if in_array($_GET['tag_id'],array(107,229,284,237,233,232)) }}class="active"{{/if}}><a href="/style-center?cate_id=1&tag_id=107">标题</a></li>
		<li {{if in_array($_GET['tag_id'],array(109,226,228,230,235,236,238,231,292,227,702)) }}class="active"{{/if}}><a href="/style-center?cate_id=1&tag_id=109">正文</a></li>
		<li {{if in_array($_GET['tag_id'],array(151,222,223,224,225,234,239,240,241,242,826,1099,1100,1101,1102,1103,1104,1105)) || is_array($_GET['tag_id']) && in_array(151,$_GET['tag_id'])}}class="active"{{/if}}><a href="/style-center?cate_id=1&tag_id[]=151&tag_id[]=111&tag_id[]=222">图文</a></li>
		<li {{if $_GET['tag_id']==264}}class="active"{{/if}}><a href="/style-center?tag_id=264">分割线</a></li>
		<li {{if $_GET['cate_id']==56 || in_array($_GET['tag_id'],array(261,262,263,939,811)) }}class="active"{{/if}}><a href="/style-center?cate_id=56">引导图</a></li>
		<li {{if in_array($_GET['tag_id'],array(227)) }}class="active"{{/if}}><a href="/style-center?cate_id=1&tag_id=227">分栏布局</a></li>
		<li {{if $_GET['only_paid']==1 }}class="active"{{/if}}><a href="/style-center?cate_id=1&only_paid=1">付费样式</a></li>
	</ul>	
	

	<div style="margin-top:5px;" class="tags-filter">
		标题：		
		<portlet cache="900" ulclass="clearfix" portlet="body" list_tpl="inner" limit="100" model="Tag" order="Tag.priority desc" info="conditions[enabled]=1&conditions[cate_id]=222">
 			<a href="/style-center?tag_id={{$item['id']}}" data-tid="{{$item['id']}}" style="{{if $item['color']}}color:{{$item['color']}};{{/if}}{{if $item['strong']}}font-weight:bold;{{/if}}" {{if $_GET['tag_id']==$item['id']}}class="active"{{/if}}>{{$item['name']}}</a>
		</portlet>
	</div>
	<div style="margin-top:2px;" class="tags-filter">
		正文：		
		<portlet cache="900" ulclass="clearfix" portlet="body" list_tpl="inner" limit="100" model="Tag" order="Tag.priority desc" info="conditions[enabled]=1&conditions[cate_id]=221">
 			<a href="/style-center?tag_id={{$item['id']}}" data-tid="{{$item['id']}}" style="{{if $item['color']}}color:{{$item['color']}};{{/if}}{{if $item['strong']}}font-weight:bold;{{/if}}" {{if $_GET['tag_id']==$item['id']}}class="active"{{/if}}>{{$item['name']}}</a>
		</portlet>
	</div>
	<div style="margin-top:2px;" class="tags-filter">
		引导：		
		<portlet cache="900" ulclass="clearfix" portlet="body" list_tpl="inner" limit="100" model="Tag" order="Tag.priority desc" info="conditions[enabled]=1&conditions[cate_id]=239">
 			<a href="/style-center?tag_id={{$item['id']}}" data-tid="{{$item['id']}}" style="{{if $item['color']}}color:{{$item['color']}};{{/if}}{{if $item['strong']}}font-weight:bold;{{/if}}" {{if $_GET['tag_id']==$item['id']}}class="active"{{/if}}>{{$item['name']}}</a>
		</portlet>
	</div>
	<div style="margin-top:2px;" class="tags-filter">
		图片：		
		<portlet cache="900" ulclass="clearfix" portlet="body" list_tpl="inner" limit="100" model="Tag" order="Tag.priority desc" info="conditions[enabled]=1&conditions[cate_id]=220">
 			<a href="/style-center?tag_id={{$item['id']}}" data-tid="{{$item['id']}}" style="{{if $item['color']}}color:{{$item['color']}};{{/if}}{{if $item['strong']}}font-weight:bold;{{/if}}" {{if $_GET['tag_id']==$item['id']}}class="active"{{/if}}>{{$item['name']}}</a>
		</portlet>
	</div>
	
	<div style="margin-top:2px;" class="tags-filter">
		风格：		
		<portlet cache="900" ulclass="clearfix" portlet="body" list_tpl="inner" limit="100" model="Tag" order="Tag.priority desc" info="conditions[enabled]=1&conditions[cate_id]=229">
 			<a href="/style-center?tag_id={{$item['id']}}" data-tid="{{$item['id']}}" style="{{if $item['color']}}color:{{$item['color']}};{{/if}}{{if $item['strong']}}font-weight:bold;{{/if}}" {{if $_GET['tag_id']==$item['id']}}class="active"{{/if}}>{{$item['name']}}</a>
		</portlet>
	</div>
	<div id="more-filter" style="display:none;">
	<div style="margin-top:2px;" class="tags-filter">
		行业：		
		<portlet cache="900" ulclass="clearfix" portlet="body" list_tpl="inner" limit="100" model="Tag" order="Tag.priority desc" info="conditions[enabled]=1&conditions[cate_id]=230">
 			<a href="/style-center?tag_id={{$item['id']}}" data-tid="{{$item['id']}}" style="{{if $item['color']}}color:{{$item['color']}};{{/if}}{{if $item['strong']}}font-weight:bold;{{/if}}" {{if $_GET['tag_id']==$item['id']}}class="active"{{/if}}>{{$item['name']}}</a>
		</portlet>
	</div>
	<div style="margin-top:2px;" class="tags-filter">
		节日：		
		<portlet cache="900" ulclass="clearfix" portlet="body" list_tpl="inner" limit="100" model="Tag" order="Tag.priority desc" info="conditions[enabled]=1&conditions[cate_id]=228">
 			<a href="/style-center?tag_id={{$item['id']}}" data-tid="{{$item['id']}}" style="{{if $item['color']}}color:{{$item['color']}};{{/if}}{{if $item['strong']}}font-weight:bold;{{/if}}" {{if $_GET['tag_id']==$item['id']}}class="active"{{/if}}>{{$item['name']}}</a>
		</portlet>
	</div>
	</div>
	<p class="text-center" style="margin: 10px 0 10px 50px;"><a href="javascript:void(0)" onclick="$('#more-filter').toggle();" style="color:#000;">▽  更多筛选标签 ▽ </a></p>

	<div>
		<portlet cache="1200" portlet="body" model="Advertise" limit="6" conditions="published=1&cate_id=242" order="priority desc" list_tpl="inner">
			<a href="/advertises/click/{{$item['id']}}" style="width:16.666%;{{if $key==0}}padding:5px 20px 15px 0;{{elseif $key==5}}padding:5px 0px 15px 20px;{{else}}padding:5px 10px 15px;{{/if}}display:inline-block;">
				<img src="{{$item['photo']}}" alt="{{$item['slogan']}}" style="border-radius:5pt;box-shadow: 0 0 10px 0 rgba(215,215,215,0.50);">
			</a>
		</portlet>
	</div>
{{elseif $category_data_model=='Image'}}
		<ul class="nav nav-tabs">
			<li {{if empty($_GET)}}class="active"{{/if}}><a href="/pictures">全部</a></li>
			<li {{if !empty($_GET)&& empty($_GET['source']) &&!in_array($_GET['cate_id'],array(84,85))}}class="active"{{/if}}><a href="/pictures?cate_id%3C%3E[]=84&cate_id%3C%3E[]=85">图片</a></li>
			<li {{if $_GET['cate_id']==85}}class="active"{{/if}}><a href="/pictures?cate_id=85">表情</a></li>
			<li {{if $_GET['cate_id']==84}}class="active"{{/if}}><a href="/pictures?cate_id=84">图标</a></li>
			<li {{if $_GET['source']=='soogif'}}class="active"{{/if}}><a href="/pictures?source=soogif">SOOGIF动图</a></li>
		</ul>
		
	{{if empty($_GET) || !in_array($_GET['cate_id'],array(84,85))}}
	<div style="margin-top:5px;" class="tags-filter">
		<a href="/pictures" {{if empty($_GET['cate_id'])}}class="active"{{/if}}>全部</a>		
		<portlet cache="900" ulclass="clearfix" portlet="body" list_tpl="inner" limit="100" model="Modelcate" order="Modelcate.left asc" info="conditions[]=Modelcate.parent_id=61">
			<?php if( in_array($item['id'],array(84,85)) ) continue; ?>
 			<a href="/pictures?cate_id={{$item['id']}}" {{if $_GET['cate_id']==$item['id']}}class="active"{{/if}}>{{$item['name']}}</a>
		</portlet>
	</div>
	{{elseif $_GET['cate_id']==85 }}
	<div style="margin-top:5px;" class="tags-filter">
		<a href="/pictures?cate_id=85" {{if empty($_GET['tag_id'])}}class="active"{{/if}}>全部</a>
		
		<portlet cache="1800" ulclass="clearfix" portlet="body" list_tpl="inner" limit="100" model="Tag" order="Tag.priority desc" info="conditions[Tag.cate_id]=235">
 			<a href="/pictures?cate_id=85&tag_id={{$item['id']}}" style="{{if $item['color']}}color:{{$item['color']}};{{/if}}{{if $item['strong']}}font-weight:bold;{{/if}}" {{if $_GET['tag_id']==$item['id']}}class="active"{{/if}}>{{$item['name']}}</a>
		</portlet>
	</div>
	{{elseif $_GET['cate_id']==84 }}
	<div style="margin-top:5px;" class="tags-filter">
		<a href="/pictures?cate_id=84" {{if empty($_GET['tag_id'])}}class="active"{{/if}}>全部</a>		
		<portlet cache="1800" ulclass="clearfix" portlet="body" list_tpl="inner" limit="100" model="Tag" order="Tag.priority desc" info="conditions[Tag.cate_id]=234">
 			<a href="/pictures?cate_id=84&tag_id={{$item['id']}}" style="{{if $item['color']}}color:{{$item['color']}};{{/if}}{{if $item['strong']}}font-weight:bold;{{/if}}" {{if $_GET['tag_id']==$item['id']}}class="active"{{/if}}>{{$item['name']}}</a>
		</portlet>
	</div>
	{{/if}}
<style>
.style-list .content{background:rgba(226,226,226,0.8)}
</style>
{{/if}}
</div>
<!-- 

<div class="alert alert-warning" style="margin:20px 0px;border:0 none;"><p><strong>提示：</strong> 样式中心的新样式付费用户可直接收藏使用，免费用户5天后可收藏使用。<a href="http://www.135plat.com/charge-service" target="_blank">升级会员</a>，快人一步。</p></div>
 -->
<div style="color:#999;" id="search-form" class="form-inline"> 排序方式：
	  <select id="sort-type" class="form-control" style="margin:3px 0px;padding: 0 10px;display: inline-block;width: auto;height: 33px">
	  	<option value="">请下拉选择</option>
	  	<option {{if empty($_REQUEST['order'])||$_REQUEST['order']=='id'}}selected{{/if}} value="id">添加时间</option>
	  	<option {{if $_REQUEST['order']=='click_nums'}}selected{{/if}} value="click_nums">点击量</option>
	  	<option {{if $_REQUEST['order']=='favor_nums'}}selected{{/if}} value="favor_nums">收藏量</option>
	  	{{if !empty($_SESSION['Auth']['Staff']) }}
	  		<option {{if $_REQUEST['order']=='updated'}}selected{{/if}} value="updated">最后更新时间</option>
	  	{{/if}}
	  </select>
	  <div style="display:inline-block;margin-left:20px;">
		<form method="get" action="{{getSearchLinks($this->request,array(),array('name','page','tag_id','cate_id'))}}">
			{{loop $_GET $k $v}}
				<?php if($k=="name" || $k=='page' || $k == 'cate_id' || $k == 'only_paid' || $k == 'tag_id') continue; ?>
				<input type="hidden" name="{{$k}}" value="{{$v}}">
			{{/loop}}
	  	<input type="text" style="height:33px;line-height:33px;padding:0 10px;" value="{{$_GET['name']}}" name="name" class="form-control"> <button class="btn btn-default btn-sm" type="submit"> <i class="fa fa-search"></i> 搜索</button>
	  </form>
  	</div>
  	&nbsp; 
  	{{if !empty($_SESSION['Auth']['Staff']) }}
  		<a href="/style-center.html?status=0" class="btn btn-primary">已下架样式</a> &nbsp;
  		<a href="/style-center.html?status=-1&cate_id=3" class="btn btn-primary">私人模板</a>
  	{{/if}}
</div>

<div class="alert alert-warning"><strong>提示</strong>：按住“<strong>Ctrl</strong>”键，并点击标签可支持多标签组合筛选</div>

<portlet return="array" return_var="frags"  cache="5" recursive="-1" limit="30" showpages="0" model="Frag"  conditions="deleted[]=0"  order="RAND()"></portlet>
			 <!-- conditions="cate_id[]=105&cate_id[]=106"  -->
<?php 
$frags =  $frags['datalist'];
$frag_index = 0;
 ?>
		<portlet portlet="onlycontent" ulclass="transparent"  title="{{$Category['Category']['name']}}">
				<!-- <div class="Content-body">{{$Category['Category']['content']}} </div> -->
				<?PHP if($total>0) {
$content0 = $content1 = $content2 = '';
				 ?>
				<div id="editor-style-list" class="row clearfix ui-portlet-list">
				    <?PHP foreach($Category['datalist'] as $key => $item) {
						$item['slug'] = $item['slug']?$item['slug']:$item['id'];
						ob_start();
    				?>	
						{{if $Category['Category']['model']=='EditorStyle'}}
							<div>{{template editor_styles/_list}}</div>
						{{elseif $Category['Category']['model']=='Color'}}
							<div>{{template colors/_list}}</div>
						{{elseif $Category['Category']['model']=='OriginalArticle'}}
							<div>{{template original_articles/_list}}</div>
						{{elseif $Category['Category']['model']=='Image'}}
							<div>{{template images/_list}}</div>
						{{elseif $Category['Category']['model']=='Video'}}
							<div>{{template videos/_list}}</div>
						{{/if}}
					<?php 
					$content = ob_get_contents();
					ob_end_clean();
					${'content'.($key%3)} .= $content; 
					} ?>
					<div id="content-0" class="col-md-4">{{$content0}}</div>
					<div id="content-1" class="col-md-4">{{$content1}}</div>
					<div id="content-2" class="col-md-4">{{$content2}}</div>
				</div>
				{{$page_navi}}
				<?php } ?>
		</portlet>
</div>
<div class="container" id="link-urls" style="background: #FFF;">	
	<portlet title="友情链接" model="Link" limit="60" conditions="published=1" list_tpl="inner">
		
		<a href="{{$item['link_url']}}" title="{{$item['name']}}" style="line-height:40px;height:40px;display:inline-block;margin:5px;" target="_blank">
			{{if $item['link_img']}}
			<img src="{{$item['link_img']}}" alt="{{$item['name']}}" style="height:40px;">
			{{else}}
				{{$item['name']}}
			{{/if}}
		</a>
	</portlet>
	<p><small>更多友情链接交换中，请与客服联系</small></p>
</div>
{{ $this->Combinator->script(array('jquery/masonry.pkgd.min.js','jquery/imagesloaded.pkgd.min.js'));}}
<script>
{{if !empty($_SESSION['Auth']['Staff']) }}
function getEvent() {
    if (document.all) {
        return window.event; //如果ie
    }
    func = getEvent.caller;
    while (func != null) {
        var arg0 = func.arguments[0];
        if (arg0) {
            if ((arg0.constructor == Event || arg0.constructor == MouseEvent) || (typeof (arg0) == "object" && arg0.preventDefault && arg0.stopPropagation)) {
//                alert(arg0);
            	return arg0;
            }
        }
        func = func.caller;
    }
    return null;
}

function open_dialog(options,url,callback,params,event){
	event = event? event:getEvent();
	var src_obj = event.srcElement ? event.srcElement:event.target;
	if(url.match(/javascript:/)){
		return false;
	}
	
	var dialogid = "dialog_"+url.replace(/\.html/g,'').replace(/http:/g,'').replace(/\/|\.|:|,|\?|=|&| /g,'_').substr(20);
	if(url.search(/\?/)!=-1){
		url+='&callbackid='+dialogid+ '&_=' + randomString(10);
	}
	else{
		url+='?callbackid='+dialogid+ '&_=' + randomString(10);
	}
	var iWidth = 960;                          //弹出窗口的宽度;
    var iHeight = 575;                         //弹出窗口的高度;
    //获得窗口的垂直位置
    var iTop = (window.screen.availHeight-30-iHeight)/2;        
    //获得窗口的水平位置
    var iLeft = (window.screen.availWidth-10-iWidth)/2;  
    var ret;
    if(window.showModalDialog){
    	ret = window.showModalDialog(url,window,'dialogHeight:575px; dialogWidth:1000px;help:No;resizable:No;status:No;scroll:Yes');
    }
    else{
    	ret = window.open(url,'new_window','dialogHeight:575px; dialogWidth:1000px;help:No;resizable:No;status:No;scroll:Yes');
    }
    if(ret>0){
    	if(typeof(callback)=='function'){
	    	if(typeof(params)=='undefined'){
				var obj = callback();
			}
			else{
				var obj = callback(params);
			};
    	}
    	if(src_obj.tagName=='A'){
			$(src_obj).trigger('onDialogSubmitSucess');
		}
		else{
			$(src_obj).closest('a').trigger('onDialogSubmitSucess');
		}
    }
	return ;
}
{{/if}}

{{if is_array($_REQUEST['tag_id'])}}
var current_tagids = {{json_encode($_REQUEST['tag_id'])}};
{{else}}
var current_tagids = [{{$_REQUEST['tag_id']}}]
{{/if}}
$(function(){
	
	$(document).on("click",'.tags-filter a', function (evt) {
        if ( evt.ctrlKey || evt.metaKey) { // ctrl键时增加多个标签参数
            var tid = $(this).data('tid');
        	var str = '';
        	for(var i in current_tagids) {
        		str+='&tag_id[]='+current_tagids[i];
        	}
        	var url = '/style-center?type=and&tag_id[]='+tid+str;
        	window.location.href = url;
        	return false;
        }
        else{
        	return true;
        }
    });
	if(current_tagids.length> 1 )　{	
		var tag_html = '<div id="selected-tags">';
		for(var i in current_tagids ) {
			$('[data-tid='+current_tagids[i]+']').addClass('active');
			
			tag_html += '<div class="btn-group">';
			tag_html += '<button data-tid="'+current_tagids[i]+'" title="去除此条件" class="btn btn-primary btn-remove btn-default" title="">'+$('[data-tid='+current_tagids[i]+']').html()+' &nbsp;<i class="glyphicon glyphicon-remove"></i></button></div>';
		}
		tag_html += '<div>';
		
		$('#search-form').after(tag_html);
		$(document).on('click','#selected-tags .btn-remove',function(){
			var str = '';
        	for(var i in current_tagids) {
        		if( $(this).data('tid') != current_tagids[i] ) {
        			str+='&tag_id[]='+current_tagids[i];
        		}
        	}
        	var url = '/style-center?type=and'+str;
			$(this).parent('.btn-group').remove();
			window.location.href = url;
		});
	}
	else{
		for(var i in current_tagids ) {
			$('[data-tid='+current_tagids[i]+']').addClass('active');
		}
	}
	
	/*var $container = $('#editor-style-list');
	// initialize Masonry after all images have loaded  
	$container.imagesLoaded( function() {
		$container.masonry({
	        itemSelector: '.mix',
	        animate: true,       
	        animationOptions: {
	            duration: 500,
	            easing: 'linear',
	            queue: false
	        }
	     });
	});
	
	setTimeout(function(){
		$('#editor-style-list').masonry({
	        itemSelector: '.mix',
	        animate: true,       
	        animationOptions: {
	            duration: 500,
	            easing: 'linear',
	            queue: false
	        }
	      });
	},1000)*/
	
	$('.style-list .content').hover(function(){
		$(this).animate({'maxHeight':'1000px'});
	},function(){
		//$(this).animate({'maxHeight':'520px'});
	});
	
	$('#sort-type').change(function(){
		var url = "{{getSearchLinks($this->request,array(), array('order'))}}";
		if(url.indexOf('?') > 0){
			url = url + '&order='+this.value;
		}
		else{
			url = url + '?order='+this.value;
		}
		window.location.href = url;
	})
})
</script>